<?php

namespace App\Http\Models;


class Fight extends BaseMessage
{

    protected $table = 'tfight';
    protected $fillable = ['ftitle', 'fbeginat', 'fmessage', 'fspace', 'fmobile', 'flinkman', 'fcustomerid'];
    protected $guarded = ['fid'];
    public static $rule = array(
        'ftitle' => 'required',
        'fbeginat' => 'required',
        'fmessage' => 'required',
        //'fspace' => 'numeric',
        'fmobile' => 'required|numeric|min:0',
        'flinkman' => 'required'
    );

    public function getList()
    {
        return Fight::where('fbeginat', '>=', date('Y-m-d', time()))->orderBy('fbeginat')->paginate(5);
    }

    public function getMylist()
    {
        return Fight::where('FCustomerID', \Illuminate\Support\Facades\Session::get('customer_id'))->orderBy('FID', 'desc')->paginate(5);
    }

}
